<f:view xmlns="http://www.w3.org/1999/xhtml"
        xmlns:f="http://java.sun.com/jsf/core" 
        xmlns:h="http://java.sun.com/jsf/html" 
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui"
        xmlns:pm="http://primefaces.org/mobile" 
        contentType="text/html" 

        >

    <pm:page  id="front" title="CarPark2013" viewport="width=device-width, initial-scale=1, minimum-scale=1 ,maximum-scale=1">
        <p:growl id="growlMsg" severity="info, error" />  

        <pm:view id="navbar" >

            <pm:header id="headr" title="  #{loginBean.loggedIn ? 'Witaj'  : 'carpark2013'}" swatch="b" fixed="true" >
                <pm:navBar id="topNav">
                    <p:button rendered="#{!loginBean.loggedIn}"  value="Home" icon="home" href="/mobile/index.xhtml" styleClass="ui-btn-active ui-state-persist"/>
                    <p:button rendered="#{!loginBean.loggedIn}" value="Kontakt" icon="forward" href="/mobile/contact.xhtml" styleClass="ui-btn-active ui-state-persist"/>
                    <p:button rendered="#{!loginBean.loggedIn}" value="News" icon="info" href="/mobile/news.xhtml" styleClass="ui-btn-active ui-state-persist"/>
                    <p:button rendered="#{!loginBean.loggedIn}" value="Oferta" icon="grid" href="/mobile/offer.xhtml" styleClass="ui-btn-active ui-state-persist"/>

                    <p:button value="Moje Dane" icon="star" rendered="#{loginBean.loggedIn}" href="/mobile/clientData.xhtml" styleClass="ui-btn-active ui-state-persist"/>
                    <p:button value="Rezerwacja" icon="plus" rendered="#{loginBean.loggedIn}" href="/mobile/reservation.xhtml" styleClass="ui-btn-active ui-state-persist"/>
                    <p:commandButton rendered="#{loginBean.loggedIn}" value="Wyloguj" actionListener="#{loginBean.doLogout()}"  icon="back" styleClass="ui-btn-active ui-state-persist">  
                        <p:confirm header="Potwierdzenie" message="Czy jesteś pewien?" icon="ui-icon-alert"/>  
                    </p:commandButton>                

                </pm:navBar>

            </pm:header>
            <pm:navBar id="botNav">
                <p:button value="Zaloguj sie" icon="star"  rendered="#{!loginBean.loggedIn}" onclick="PF('dlgModalLOGIN').show()" styleClass="ui-btn-active ui-state-persist" />
                <p:button value="Rejestracja" icon="plus" rendered="#{!loginBean.loggedIn}" href="/mobile/register.xhtml" styleClass="ui-btn-active ui-state-persist"/>

                <p:button rendered="#{loginBean.loggedIn}" value="Home" icon="home" href="/mobile/index.xhtml" styleClass="ui-btn-active ui-state-persist"/>
                <p:button rendered="#{loginBean.loggedIn}" value="Kontakt" icon="forward" href="/mobile/contact.xhtml" styleClass="ui-btn-active ui-state-persist"/>
                <p:button rendered="#{loginBean.loggedIn}" value="News" icon="info" href="/mobile/news.xhtml" styleClass="ui-btn-active ui-state-persist"/>
                <p:button rendered="#{loginBean.loggedIn}" value="Oferta" icon="grid" href="/mobile/offer.xhtml" styleClass="ui-btn-active ui-state-persist"/>


            </pm:navBar>


            <p:dialog header="Logowanie" widgetVar="dlgModalLOGIN" modal="true">                    
                <h:form id="login">

                    <p:inputText value="#{loginBean.username}" id="login" label="Login:" required="true"/>
                    <p:inputText value="#{loginBean.password}" id="pass" label="Hasło:" type="password" required="true"/>


                    <p:commandLink id="log" value="Zaloguj" type="button" oncomplete="PF('dlgModalLOGIN').hide()"
                                   actionListener="#{loginBean.doLogin}" update=":botNav, :topNav, :growlMsg">
                    </p:commandLink>
                </h:form>
            </p:dialog>

            <p:confirmDialog global="true" widgetVar="confLog">    
                <h:form id="logout">
                    <p:commandButton value="Tak" type="button" styleClass="ui-confirmdialog-yes" inline="true" icon="check" actionListener="#{loginBean.doLogout()}" update=":botNav, :topNav, :growlMsg">
                        <f:attribute name="swatch" value="b"/>                                
                    </p:commandButton>  
                    <p:commandButton value="Nie" type="button" styleClass="ui-confirmdialog-no" inline="true" icon="delete"/> 
                </h:form>
            </p:confirmDialog> 
            <pm:content >
                <ui:insert name="content" />
            </pm:content>
        </pm:view>


    </pm:page>
</f:view>